package com.controller;


import com.model.ListConfig;
import com.model.Student;
import com.model.User;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/ioc")
//@Controller
@RestController
public class Ioc {
    public void sayHi(){
        System.out.println("hello word!!!!!");
    }

    @Qualifier("zhangsan")
    @Autowired
    private User user;
    @RequestMapping("/i1")
    public String ioc(){
        System.out.println(user.getName());
        return user.getName();
    }

    @Value("${Mykey.key}")
    private String key;

    @RequestMapping("/i2")
    public String ioc2(){
        return "读取到的key为："+key;
    }

    @Autowired
private Student student;
@RequestMapping("/i3")
public String getKey(){
return "name:"+student.getName()+"   id:"+student.getId()+"    age:"+student.getAge();
    }

    @Autowired
    private ListConfig listConfig;
    @RequestMapping("/i4")
    public String getkey2(){
    return listConfig.toString();
    }


}
